/**
 * create by pntrinh87@gmail.com
 * create date 19/01/2011
 */
function TrSlide(){
    this.images = new Array;
    this.idnow  = 0;
    this.idImg  = 0;
    this.count  = 0;
    
    this.add = function(arg)
    {
        this.images[this.count]=new Image();
        this.images[this.count].src=arg;  
        this.count++;       
    };
    this.start = function(arg)
    {
        this.idImg  = document.getElementById(arg.img);
        this.idDiv  = document.getElementById(arg.div);
        this.time   = arg.time;
        this.run();
    };
    this.run  = function()
    {
        _root=this;
        if(this.idnow>=this.count)this.idnow=0;
        this.idImg.src      = this.images[this.idnow].src;
        this.idDiv.scrollTop=0;
        this.tgo            = setInterval(function(){_root.godown()},this.time);
        this.idnow++;
    };
    this.godown = function()
    {
        var oldscroll   = this.idDiv.scrollTop;
        this.idDiv.scrollTop +=1.5;
        if(this.idDiv.scrollTop<=oldscroll)
        {
            clearInterval(this.tgo);
            this.nextsl();
        }
    };
    this.nextsl  = function()
    { 
        this.run();
    }
}